<style>
    .layui-form-item label {
        width: 120px;
    }
    .classifyimg{
        margin-bottom: 20px;
        width: 672px !important;
    }
    .classifyimg-item{
        display: inline-block;
        width: 140px;
    }
    .classifyimg img{
        width: 100px;
        display: block;
    }
    .classifyimg .layui-form-radio{
        vertical-align: top;
        display: block;
        margin-bottom: 10px;
    }
    .image_storage_type .item{
        display: none;
    }
</style>
<div class="layui-card" style="padding:10px;">

    <div class="layui-tab" lay-filter="setting">
        <ul class="layui-tab-title">
<!--            <li lay-id="platform" class="layui-this">平台设置</li>-->
<!--            <li lay-id="share">分享设置</li>-->
<!--            <li lay-id="users">会员设置</li>-->
<!--            <li lay-id="goods">商品设置</li>-->
<!--            <li lay-id="order">订单管理</li>-->
<!--            <li lay-id="points">积分设置</li>-->
<!--            <li lay-id="cash">提现设置</li>-->
<!--            <li lay-id="other">其他设置</li>-->
            {volist name="systemGroup" id="vo"}
            <li lay-id="{$vo.id}" {if $key+1 == 1} class="layui-this" {/if}>{$vo.name}</li>
            {/volist}
        </ul>
        <div class="layui-tab-content">


            {foreach $systemGroup as $key=>$vo }
            <div class="layui-tab-item {if $key+1 == 1}layui-show{/if}">

                <form class="layui-form seller-alone-form" action="" method="post">

                    {if array_key_exists($vo.id,$system)}
                    {foreach $system[($key+1)] as $k=>$v }
                    {if $v['status']}
                    {if $v['type'] =='text'}
                    <div class="layui-form-item">
                        <label class="layui-form-label">{$v.name}：</label>
                        <div class="layui-input-inline seller-inline-5">
                            <input type="text" name="{$v.field}" value="{$v.value}" lay-verify="title" autocomplete="off" placeholder="{$v.tips}" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">{$v.tips}</div>
                    </div>
                    {/if}
                    {/if}
                    {/foreach}
                    {/if}
                    <div class="layui-form-item">
                        <label class="layui-form-label">&nbsp;</label>
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="save" style="height: 37px;padding: 0 27px;font-size: 14px;">保存</button>
                        </div>
                    </div>

                </form>
            </div>
            {/foreach}

        </div>
    </div>
</div>

<script>
    layui.use(['form', 'element', 'table'], function() {
        var form = layui.form, element = layui.element, table = layui.table;
        //显示当前tab
        if (location.hash) {
            element.tabChange('setting', location.hash.replace(/^#/, ''));
        }
        element.on('tab(setting)', function () {
            var othis = $(this), layid = othis.attr('lay-id');
            if (layid) {
                location.hash = layid;
            }
        });
        //保存商品
        form.on('submit(save)', function(data) {
            formData = data.field;

            if (!formData) {
                layer.msg('请先完善数据', {
                    time: 1300
                }); //layer.msg(JSON.stringify(data.field));
                return false;
            }
            JsPost('{:url("System/systemPost")}',formData,function(e){


                if (e.code === 1) {
                    layer.msg('保存成功');
                } else {
                    layer.msg(e.msg, {
                        time: 1300
                    });
                }
            });
            return false;
        });
        //积分奖励类型切换
        var type = $("#sign_point_type").val();
        if (type == 1) {
            $(".sign-random").hide();
            $(".sign-fixed").show();
        } else {
            $(".sign-random").show();
            $(".sign-fixed").hide();
        }
        form.on('radio(sign_point_type)', function(data) {
            if (data.value == 1) {
                $(".sign-random").hide();
                $(".sign-fixed").show();
            } else {
                $(".sign-random").show();
                $(".sign-fixed").hide();
            }
        });
        //存储引擎切换
        form.on('select(image_storage_type)', function(data) {
            $(".image_storage_type .item").hide(10);
            $("."+data.value).show(10);
        });

        //监听文章列表页工具条
        table.on('tool(articleTable)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的DOM对象
            if(layEvent === 'selectArticle'){ //选择
                var article_id_key = $("#article_id_key").val();
                var article_name_key = $("#article_name_key").val();
                $("#"+article_id_key).val(data.id);
                $("#"+article_name_key).val(data.title);
                layer.close(window.box);
            }
        });
    });
    function article_list(id, name)
    {
        JsGet("{:url('Carousel/getArticle')}?article_id_key="+id+"&article_name_key="+name,function(e){
            window.box = layer.open({
                type: 1,
                content: e,
                area: ['700px', '450px'],
                title:'文章列表'
            });
        });
    }
</script>